

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[spPlate_UpdatePlate]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [dbo].[spPlate_UpdatePlate]
GO

GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Eric Liew
-- Create date: 6/2/2009
-- Description:	Update a Owner
-- =============================================
CREATE PROCEDURE [dbo].[spPlate_UpdatePlate]
(
	@PlateId Int,
	@PlateNumber Varchar(10),
	@OwnerId Int,
	@PlateTypeId INT,
	@Account Varchar(50),
	@Bank Varchar(50),
	@Comment Varchar(500),
	@EndDate DATETIME,
	@StartDate DATETIME,
	@GST Varchar(50),
	@MonthlyRate Varchar(50),
	@WeeklyRate Varchar(50)
)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON

	UPDATE Plate
	SET
		PlateNumber = @PlateNumber,
		OwnerId = @OwnerId,
		PlateTypeId = @PlateTypeId
	WHERE
		PlateId = @PlateId    

	UPDATE PlateFinancial
	SET Account = @Account,
		Bank = @Bank,
		Comment = @Comment,
		EndDate = @EndDate,
		StartDate = @StartDate,
		GST = @GST,
		MonthlyRate = @MonthlyRate,
		WeeklyRate = @WeeklyRate
	WHERE PlateFinancial.PlateId = @PlateId
 

END
GO
